package edu.cmu.fithub.formbeans;

import java.util.ArrayList;
import java.util.List;
import org.mybeans.form.FormBean;

public class WorkoutForm extends FormBean {

	private String userId;
	private String workoutId;
	private String datetime;
	private String email;
	private String action;

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public String getWorkoutId() {
		return workoutId;
	}

	public void setWorkoutId(String workoutId) {
		this.workoutId = workoutId;
	}

	public String getDatetime() {
		return datetime;
	}

	public void setDatetime(String datetime) {
		this.datetime = datetime;
	}

	public String getAction() {
		return action;
	}

	public void setAction(String action) {
		this.action = action;
	}

	public List<String> getValidationErrors() {
		List<String> errors = new ArrayList<String>();

		if (email == null || email.length() == 0) {
			errors.add("Email is required");
		} else if (email.matches(".*[<>].*")) {
			errors.add("Invalid Email");
		}

		return errors;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getEmail() {
		return email;
	}
}
